import { requestClient } from '#/api/request';

export namespace MessageApi {
  export interface ReadDeleteMsgs {
    msgIds: string;
  }
}
const getNoSentMessage = (userId: string) => {
  return requestClient.get(`/dsc-systemMS/dsc-message/getNotReadMsg/${userId}`);
};
const getAllMsg = (userId: string, pageIndex: number) => {
  return requestClient.get(
    `/dsc-systemMS/dsc-message/getAllMsg/${userId}/${pageIndex}`,
  );
};
const readMsgs = (readAllMsgsObj: MessageApi.ReadDeleteMsgs) => {
  return requestClient.put(
    '/dsc-systemMS/dsc-message/readAllMsgs',
    readAllMsgsObj,
  );
};
const readAMsg = (msgId: string) => {
  return requestClient.put(`/dsc-systemMS/dsc-message/readAMsg/${msgId}`);
};
const deleteMsgs = (deleteIdsArr: Array<string>) => {
  return requestClient.delete('/dsc-systemMS/dsc-message/deleteMsgs/', {
    data: { msgIds: deleteIdsArr },
  });
};
export default {
  getNoSentMessage,
  getAllMsg,
  readMsgs,
  readAMsg,
  deleteMsgs,
};
